import Vue from 'vue'

import 'normalize.css'
import ElementUI from 'element-ui'
import SvgIcon from 'vue-svgicon'

import '@/assets/styles/element/element-variables.scss'
import '@/assets/styles/index.scss'

import App from '@/App.vue'
import store from '@/core/store'
import {AppModule} from '@/core/store/modules/app'
import router from '@/core/router'
import i18n from '@/assets/language'
import '@/assets/icons/components'
import '@/permission'
import * as filters from '@/core/filters'
import VueStorage from "vue-ls";
import settings from "@/core/config/settings";

Vue.use(VueStorage, settings.storage);

Vue.use(ElementUI, {
    size: AppModule.size, // Set element-ui default size
    i18n: (key: string, value: string) => i18n.t(key, value)
});

Vue.use(SvgIcon, {
    tagName: 'svg-icon',
    defaultWidth: '1em',
    defaultHeight: '1em'
});

//注册全局过滤器功能
Object.keys(filters).forEach(key => {
    Vue.filter(key, (filters as { [key: string]: Function })[key])
});

Vue.config.productionTip = false;

//异常信息处理
Vue.config.errorHandler = function (err, vm, info) {
    console.log(`异常信息: ${err.toString()}`);
    console.log(`info: ${info}`);
    console.log(vm);
};
//警告信息处理
Vue.config.warnHandler = function (msg, vm, trace) {
    console.log(`友情提示信息: ${msg}\nTrace: ${trace}`);
};

new Vue({
    router,
    store,
    i18n,
    render: (h) => h(App)
}).$mount('#app');
